//
//  OrderCell.swift
//  Xiaozihui
//
//  Created by 校企荟 on 2017/10/11.
//  Copyright © 2017年 校企荟. All rights reserved.
//

import UIKit

class OrderCell: BaseTableViewCell {

    lazy var imageIV = {
        return UIImageView()
    }()
    
    lazy var orderLbl : UILabel = {
        let lbl = UILabel(content: "订单号:23245234256", textFont: UIFont.systemFont(ofSize: 14 * ScaleX), color: XZHColor(red: 51, green: 51, blue: 51, alpha: 1), alignment: .left, numberOfLine: 1)
        return lbl
    }()
    
    lazy var titleLbl: UILabel = {
        let lbl = UILabel(content: "资产名称资产名称资产名称资产名称资产名称资产名称资产名称资产名称资产名称资产名称资产名称资产名称", textFont: UIFont.boldSystemFont(ofSize: 15 * ScaleX), color: XZHColor(red: 51, green: 51, blue: 51, alpha: 1), alignment: .left, numberOfLine: 2)
        return lbl
    }()
    
    lazy var timeLbl:UILabel = {
        let lbl = UILabel(content: "2017-07-17", textFont: UIFont.systemFont(ofSize: 11 * ScaleX), color: XZHColor(red: 85, green: 85, blue: 85, alpha: 1), alignment: .left, numberOfLine: 1)
        return lbl
    }()
    
    lazy var descLbl:UILabel = {
        let lbl = UILabel(content: "故障描述:电源接触不良资产名称资产名称资产名称资产名称资产名称资产名称资产名称资产名称资产名称资产名称资产名称资产名称", textFont: UIFont.systemFont(ofSize: 14 * ScaleX), color: XZHColor(red: 85, green: 85, blue: 85, alpha: 1), alignment: .left, numberOfLine: 2)
        return lbl
    }()
    
    lazy var companyLbl:UILabel = {
        let lbl = UILabel(content: "第一居委资产名称资产名称资产名称资产名称资产名称资产名称资产名称资产名称资产名称资产名称资产名称资产名称", textFont: UIFont.systemFont(ofSize: 14 * ScaleX), color: XZHColor(red: 85, green: 85, blue: 85, alpha: 1), alignment: .left, numberOfLine: 2)
        return lbl
    }()
    
    lazy var statusLbl:UILabel = {
        let lbl = UILabel(content: "维修预约中", textFont: UIFont.systemFont(ofSize: 14 * ScaleX), color: XZHColor(red: 51, green: 51, blue: 51, alpha: 1), alignment: .center, numberOfLine: 1)
        return lbl
    }()
    
    lazy var scoreLbl:UILabel = {
        let lbl = UILabel(content: "评分5.0", textFont: UIFont.systemFont(ofSize: 14 * ScaleX), color: mainColor, alignment: .center, numberOfLine: 1)
        return lbl
    }()
    
    var model:OrderModel? {
        didSet {
            
        }
    }
    
    
    
    override var frame: CGRect {
        didSet {
            var newFrame = frame
//            newFrame.size.width -= 20 * ScaleX
            newFrame.size.height -= 10
//            newFrame.origin.x += 10 * ScaleX
//            newFrame.origin.y += 5 * ScaleX
            super.frame = newFrame
        }
    }
    
    
    override  func setupUI() {
        self.contentView.layer.cornerRadius = 5
        self.contentView.layer.masksToBounds = true
        contentView.addSubview(orderLbl)
        contentView.addSubview(titleLbl)
        contentView.addSubview(companyLbl)
        contentView.addSubview(timeLbl)
        contentView.addSubview(descLbl)
        contentView.addSubview(statusLbl)
        contentView.addSubview(scoreLbl)
        
        
        orderLbl.snp.makeConstraints { (make) in
            make.left.equalTo(contentView).offset(10)
            make.top.equalTo(contentView).offset(10)
        }
        
        timeLbl.snp.makeConstraints { (make) in
            make.right.equalTo(contentView).offset(-10)
            make.centerY.equalTo(orderLbl)
        }
        
        let line = UIView()
        line.backgroundColor = XZHColor(red: 222, green: 222, blue: 223, alpha: 1)
        contentView.addSubview(line)
        
        line.snp.makeConstraints { (make) in
            make.left.equalTo(contentView).offset(10)
            make.right.equalTo(contentView).offset(-10)
            make.top.equalTo(orderLbl.snp.bottom).offset(8)
            make.height.equalTo(1)
        }

        titleLbl.snp.makeConstraints { (make) in
            make.top.equalTo(line.snp.bottom).offset(8)
            make.left.equalTo(contentView).offset(10 )
            make.width.equalTo(250 * ScaleX)
        }

        descLbl.snp.makeConstraints { (make) in
            make.top.equalTo(titleLbl.snp.bottom).offset(8)
            make.left.equalTo(titleLbl)
            make.width.equalTo(250 * ScaleX)
        }
        
        companyLbl.snp.makeConstraints { (make) in
            make.top.equalTo(descLbl.snp.bottom).offset(8)
            make.left.equalTo(titleLbl)
            make.width.equalTo(250 * ScaleX)
            make.bottom.equalTo(contentView).offset(-10)
        }
        
        statusLbl.snp.makeConstraints { (make) in
            make.right.equalTo(contentView).offset(-10)
            make.top.equalTo(line.snp.bottom).offset(15)
        }
        
        scoreLbl.snp.makeConstraints { (make) in
            make.centerX.equalTo(statusLbl)
            make.top.equalTo(statusLbl.snp.bottom).offset(8)
        }
        
    }
    
    
    
    
    
    

}
